

#ifndef UD_DBENTS_H
#define UD_DBENTS_H

#include "zdbmain.h"
#include "zdbcurve.h"
#include "zgescl3d.h"
#include "zgepnt2d.h"
#include "zdbmtext.h"
#include "zdbbackground.h"
#include "zdbdim.h"
#include "zgept2dar.h"
#include "zgedblar.h"
#include "zdbsymtb.h"
#include "zgemat3d.h"
#include "zAcDbXref.h"
#include "zacgi.h"
#include "zacgiviewport.h"
#include "zacgivisualstyle.h"

#pragma pack(push, 8)

class UcDbAttribute;
class UcDbSequenceEnd;
class UcDb3dPolylineVertex;
class UcDb2dVertex;
class UcDbMText;
class UcDbAnnotationScale;

namespace Ztil 
{
	class Image;
}

class UcDbText: public UcDbEntity
{
public:
    UcDbText();
    UcDbText(
        const UcGePoint3d&  position,
        const ZTCHAR*        text,
        UcDbObjectId        style = UcDbObjectId::kNull,
        double              height = 0,
        double              rotation = 0);
    ~UcDbText();
    UCDB_DECLARE_MEMBERS(UcDbText);

    UcGePoint3d         position() const;
    Ucad::ErrorStatus   setPosition(const UcGePoint3d&);

    UcGePoint3d         alignmentPoint() const;
    Ucad::ErrorStatus   setAlignmentPoint(const UcGePoint3d&);
    ZSoft::Boolean      isDefaultAlignment() const;

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    virtual ZSoft::Boolean    isPlanar() const { return ZSoft::kTrue; }
    virtual Ucad::ErrorStatus getPlane(UcGePlane&, UcDb::Planarity&) const;

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    double              oblique() const;
    Ucad::ErrorStatus   setOblique(double);

    double              rotation() const; 
    Ucad::ErrorStatus   setRotation(double);

    double              height() const; 
    Ucad::ErrorStatus   setHeight(double);

    double              widthFactor() const; 
    Ucad::ErrorStatus   setWidthFactor(double);

    ZTCHAR*              textString() const;
    const ZTCHAR*        textStringConst() const;
    Ucad::ErrorStatus   setTextString(const ZTCHAR*);
     
    UcDbObjectId        textStyle() const;
    Ucad::ErrorStatus   setTextStyle(UcDbObjectId);
    
    ZSoft::Boolean      isMirroredInX() const;
    Ucad::ErrorStatus   mirrorInX(ZSoft::Boolean);
     
    ZSoft::Boolean      isMirroredInY() const;
    Ucad::ErrorStatus   mirrorInY(ZSoft::Boolean);
     
    UcDb::TextHorzMode  horizontalMode() const;
    Ucad::ErrorStatus   setHorizontalMode(UcDb::TextHorzMode);
     
    UcDb::TextVertMode  verticalMode() const;
    Ucad::ErrorStatus   setVerticalMode(UcDb::TextVertMode);

    int                 correctSpelling();
    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
    virtual ZSoft::UInt32       setAttributes(UcGiDrawableTraits* pTraits);

    virtual Ucad::ErrorStatus   adjustAlignment(
        const UcDbDatabase* pDb = nullptr);

    Ucad::ErrorStatus   setField(const ZTCHAR* pszPropName, UcDbField* pField,
                                 UcDbObjectId& fieldId);

    Ucad::ErrorStatus   removeField(UcDbObjectId fieldId);
    Ucad::ErrorStatus   removeField(const ZTCHAR* pszPropName, UcDbObjectId& returnId);
    Ucad::ErrorStatus   removeField(const ZTCHAR* pszPropName);

    Ucad::ErrorStatus   convertFieldToText();

    virtual bool        castShadows() const;
    virtual bool        receiveShadows() const;
};

class UcDbAttributeDefinition: public UcDbText
{
public:
    UcDbAttributeDefinition();
    UcDbAttributeDefinition(
        const UcGePoint3d& position,
        const ZTCHAR*       text,
        const ZTCHAR*       tag,
        const ZTCHAR*       prompt,
        UcDbObjectId       style = UcDbObjectId::kNull);
    ~UcDbAttributeDefinition();
    UCDB_DECLARE_MEMBERS(UcDbAttributeDefinition);

    ZTCHAR*              prompt() const;
    const ZTCHAR*        promptConst() const;
    Ucad::ErrorStatus   setPrompt(const ZTCHAR*);
     
    ZTCHAR*              tag() const;
    const ZTCHAR*        tagConst() const;
    Ucad::ErrorStatus   setTag(const ZTCHAR*);
 
    ZSoft::Boolean      isInvisible() const;
    Ucad::ErrorStatus   setInvisible(ZSoft::Boolean);
 
    ZSoft::Boolean      isConstant() const;
    Ucad::ErrorStatus   setConstant(ZSoft::Boolean);
 
    ZSoft::Boolean      isVerifiable() const;
    Ucad::ErrorStatus   setVerifiable(ZSoft::Boolean);
 
    ZSoft::Boolean      isPreset() const;
    Ucad::ErrorStatus   setPreset(ZSoft::Boolean);
     
    ZSoft::UInt16       fieldLength() const;
    Ucad::ErrorStatus   setFieldLength(ZSoft::UInt16);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;

    virtual Ucad::ErrorStatus   adjustAlignment(
        const UcDbDatabase* pDb = nullptr);

	bool				lockPositionInBlock() const;
	Ucad::ErrorStatus	setLockPositionInBlock	(bool bValue);
	bool              isMTextAttributeDefinition          () const;
	UcDbMText *       getMTextAttributeDefinition         () const;
	const UcDbMText * getMTextAttributeDefinitionConst    () const;
	Ucad::ErrorStatus setMTextAttributeDefinition         (UcDbMText*);
	Ucad::ErrorStatus convertIntoMTextAttributeDefinition (ZSoft::Boolean val = ZSoft::kTrue);
	Ucad::ErrorStatus updateMTextAttributeDefinition      ();
};

class UcDbAttribute: public UcDbText
{
public:
    UcDbAttribute();
    UcDbAttribute(
        const UcGePoint3d& position,
        const ZTCHAR*       text,
        const ZTCHAR*       tag,
        UcDbObjectId       style = UcDbObjectId::kNull);
    ~UcDbAttribute();
    UCDB_DECLARE_MEMBERS(UcDbAttribute);

    ZTCHAR*              tag() const;
    const ZTCHAR*        tagConst() const;
    Ucad::ErrorStatus   setTag(const ZTCHAR* newTag);

    ZSoft::Boolean      isInvisible() const;
    Ucad::ErrorStatus   setInvisible(ZSoft::Boolean);

    ZSoft::Boolean      isConstant() const;
    ZSoft::Boolean      isVerifiable() const;
    ZSoft::Boolean      isPreset() const;

    ZSoft::UInt16       fieldLength() const;
    Ucad::ErrorStatus   setFieldLength(ZSoft::UInt16);

    Ucad::ErrorStatus setAttributeFromBlock(const UcGeMatrix3d& blkXform);
    Ucad::ErrorStatus setAttributeFromBlock(
        const UcDbAttributeDefinition *pAttdef,
        const UcGeMatrix3d& blkXform);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
    bool lockPositionInBlock() const;
	Ucad::ErrorStatus	setLockPositionInBlock	(bool bValue);
	bool              isMTextAttribute          ()                        const;
	UcDbMText *       getMTextAttribute         ()                        const;
	const UcDbMText * getMTextAttributeConst    ()                        const;
	Ucad::ErrorStatus setMTextAttribute         (UcDbMText *);
	Ucad::ErrorStatus convertIntoMTextAttribute (ZSoft::Boolean val = ZSoft::kTrue);
	Ucad::ErrorStatus updateMTextAttribute      ();
	bool              isReallyLocked            ()                        const;
	
};

class UcDbBlockReference: public UcDbEntity
{
public:
            UcDbBlockReference();
            UcDbBlockReference(const UcGePoint3d&  position,
                                     UcDbObjectId  blockTableRec);
            ~UcDbBlockReference();
    UCDB_DECLARE_MEMBERS(UcDbBlockReference);

            UcDbObjectId      blockTableRecord() const;
    virtual Ucad::ErrorStatus setBlockTableRecord(UcDbObjectId);

    virtual UcGePoint3d       position() const;
    virtual Ucad::ErrorStatus setPosition(const UcGePoint3d&);

            UcGeScale3d       scaleFactors() const;
            UcGeScale3d       nonAnnotationScaleFactors() const;
    virtual Ucad::ErrorStatus setScaleFactors(const UcGeScale3d& scale);

            double            rotation() const;
    virtual Ucad::ErrorStatus setRotation(double newVal);

            UcGeVector3d      normal() const;
    virtual Ucad::ErrorStatus setNormal(const UcGeVector3d& newVal);

    virtual ZSoft::Boolean    isPlanar() const { return ZSoft::kTrue; }
    virtual Ucad::ErrorStatus getPlane(UcGePlane&, UcDb::Planarity&) const;

            UcGeMatrix3d      blockTransform() const;
            UcGeMatrix3d      nonAnnotationBlockTransform() const;
    virtual Ucad::ErrorStatus setBlockTransform(const UcGeMatrix3d&);

            Ucad::ErrorStatus appendAttribute(UcDbAttribute*);
            Ucad::ErrorStatus appendAttribute(UcDbObjectId&, UcDbAttribute*);

            Ucad::ErrorStatus openAttribute(UcDbAttribute*&, UcDbObjectId,
                                            UcDb::OpenMode,
                                            bool openErasedOne = false);

            Ucad::ErrorStatus openSequenceEnd(UcDbSequenceEnd*&, UcDb::OpenMode);

            UcDbObjectIterator*  attributeIterator() const;

    virtual ZSoft::Boolean    treatAsUcDbBlockRefForExplode() const;

    virtual  Ucad::ErrorStatus getSubentPathsAtGsMarker(
                                  UcDb::SubentType,
                                  ZSoft::GsMarker       gsMark,
                                  const UcGePoint3d&    pickPoint,
                                  const UcGeMatrix3d&   viewXform,
                                  int&                  numPaths,
                                  UcDbFullSubentPath*&  subentPaths,
                                  int                   numInserts = 0,
                                  UcDbObjectId*         entAndInsertStack = nullptr) const;

    virtual  Ucad::ErrorStatus getGsMarkersAtSubentPath(
                                  const UcDbFullSubentPath& subPath,
                                  UcArray<ZSoft::GsMarker>& gsMarkers) const;

    virtual Ucad::ErrorStatus highlight  (const UcDbFullSubentPath&
                                          = kNullSubent, const ZSoft::Boolean highlightAll = ZSoft::kFalse) const;

    virtual Ucad::ErrorStatus unhighlight(const UcDbFullSubentPath&
                                          = kNullSubent, const ZSoft::Boolean highlightAll = ZSoft::kFalse) const;

    virtual UcDbEntity*       subentPtr  (const UcDbFullSubentPath&) const;

    virtual ZSoft::Boolean    worldDraw(UcGiWorldDraw* mode);
    virtual void              viewportDraw(UcGiViewportDraw* mode);

            Ucad::ErrorStatus geomExtentsBestFit(
                                        UcDbExtents& extents,
                                        const UcGeMatrix3d& parentXform =
                                            UcGeMatrix3d::kIdentity) const;

    virtual Ucad::ErrorStatus explodeToOwnerSpace() const;

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
    virtual void gripStatus(const UcDb::GripStat status);
};

class UcDbMInsertBlock: public UcDbBlockReference
{
public:
    UcDbMInsertBlock();
    UcDbMInsertBlock(
        const UcGePoint3d&  position,
        UcDbObjectId        blockTableRec,
        ZSoft::UInt16       columns,
        ZSoft::UInt16       rows,
        double              colSpacing,
        double              rowSpacing);
    ~UcDbMInsertBlock();
    UCDB_DECLARE_MEMBERS(UcDbMInsertBlock);

    ZSoft::UInt16      columns() const;
    Ucad::ErrorStatus  setColumns(ZSoft::UInt16);

    ZSoft::UInt16      rows() const;
    Ucad::ErrorStatus  setRows(ZSoft::UInt16);

    double             columnSpacing() const;
    Ucad::ErrorStatus  setColumnSpacing(double);

    double             rowSpacing() const;
    Ucad::ErrorStatus  setRowSpacing(double);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};

class UcDbBlockBegin: public UcDbEntity
{
public:
    UcDbBlockBegin();
    ~UcDbBlockBegin();
    UCDB_DECLARE_MEMBERS(UcDbBlockBegin);

    virtual bool castShadows() const;
    virtual void setCastShadows(bool newVal);
    virtual bool receiveShadows() const;
    virtual void setReceiveShadows(bool newVal);
};

class UcDbBlockEnd: public UcDbEntity
{
public:
    UcDbBlockEnd();
    ~UcDbBlockEnd();
    UCDB_DECLARE_MEMBERS(UcDbBlockEnd);

    virtual bool castShadows() const;
    virtual void setCastShadows(bool newVal);
    virtual bool receiveShadows() const;
    virtual void setReceiveShadows(bool newVal);
};

class UcDbSequenceEnd: public UcDbEntity
{
public:
    UcDbSequenceEnd();
    ~UcDbSequenceEnd();
    UCDB_DECLARE_MEMBERS(UcDbSequenceEnd);

    virtual bool castShadows() const;
    virtual void setCastShadows(bool newVal);
    virtual bool receiveShadows() const;
    virtual void setReceiveShadows(bool newVal);
};

class UcDbVertex: public UcDbEntity
{
public:
    UcDbVertex();
    ~UcDbVertex();
    UCDB_DECLARE_MEMBERS(UcDbVertex);
};

inline UcDbVertex::~UcDbVertex()
{
}

class UcDb2dVertex: public UcDbVertex
{
public:
    UcDb2dVertex();
    ~UcDb2dVertex();
    UCDB_DECLARE_MEMBERS(UcDb2dVertex);
    UcDb2dVertex(
        const UcGePoint3d&  position,
        double   bulge      = 0,
        double   startWidth = 0,
        double   endWidth   = 0,
        double   tangent    = 0,
		ZSoft::Int32 vertexIdentifier = 0);

    UcDb::Vertex2dType vertexType() const;
    UcGePoint3d         position() const;
    Ucad::ErrorStatus   setPosition(const UcGePoint3d&);

    double              startWidth() const;
    Ucad::ErrorStatus   setStartWidth(double newVal);

    double              endWidth() const;
    Ucad::ErrorStatus   setEndWidth(double newVal);

    double              bulge() const;
    Ucad::ErrorStatus   setBulge(double newVal);

    ZSoft::Boolean      isTangentUsed() const;
    Ucad::ErrorStatus   useTangent();
    Ucad::ErrorStatus   ignoreTangent();

    double              tangent() const;
    Ucad::ErrorStatus   setTangent(double newVal);

	Ucad::ErrorStatus   setVertexIdentifier(ZSoft::Int32 suggestedValue);
	int                 vertexIdentifier() const;
};

class UcDb3dPolylineVertex: public UcDbVertex
{
public:
    UcDb3dPolylineVertex();
    ~UcDb3dPolylineVertex();
    UCDB_DECLARE_MEMBERS(UcDb3dPolylineVertex);
    UcDb3dPolylineVertex(const UcGePoint3d&);

    UcDb::Vertex3dType vertexType() const;
    UcGePoint3d         position() const;
    Ucad::ErrorStatus   setPosition(const UcGePoint3d&);
};

class UcDbPolygonMeshVertex: public UcDbVertex
{
public:
    UcDbPolygonMeshVertex();
    UcDbPolygonMeshVertex(const UcGePoint3d&  position);
    ~UcDbPolygonMeshVertex();
    UCDB_DECLARE_MEMBERS(UcDbPolygonMeshVertex);

    UcDb::Vertex3dType vertexType() const;

    UcGePoint3d         position() const;
    Ucad::ErrorStatus   setPosition(const UcGePoint3d&);

};

class UcDbPolyFaceMeshVertex: public UcDbVertex
{
public:
    UcDbPolyFaceMeshVertex();
    UcDbPolyFaceMeshVertex(const UcGePoint3d&  position);
    ~UcDbPolyFaceMeshVertex();
    UCDB_DECLARE_MEMBERS(UcDbPolyFaceMeshVertex);

    UcGePoint3d         position() const;
    Ucad::ErrorStatus   setPosition(const UcGePoint3d&);

};

class UcDbFaceRecord: public UcDbVertex
{
public:
    UcDbFaceRecord();

    UcDbFaceRecord(ZSoft::Int16 vtx0, ZSoft::Int16 vtx1,
                   ZSoft::Int16 vtx2, ZSoft::Int16 vtx3);
    ~UcDbFaceRecord();
    UCDB_DECLARE_MEMBERS(UcDbFaceRecord);
    Ucad::ErrorStatus getVertexAt(ZSoft::UInt16 faceIdx,
                                  ZSoft::Int16& vtxIdx) const;
    Ucad::ErrorStatus setVertexAt(ZSoft::UInt16 faceIdx,
                                  ZSoft::Int16  vtxIdx);

    Ucad::ErrorStatus isEdgeVisibleAt(ZSoft::UInt16 faceIndex,
                                      ZSoft::Boolean& visible) const;

    Ucad::ErrorStatus makeEdgeVisibleAt(ZSoft::UInt16 faceIndex);
    Ucad::ErrorStatus makeEdgeInvisibleAt(ZSoft::UInt16 faceIndex);
};

class UcDb2dPolyline: public UcDbCurve
{
public:
    UcDb2dPolyline();
    ~UcDb2dPolyline();
    UCDB_DECLARE_MEMBERS(UcDb2dPolyline);
    UcDb2dPolyline (
        UcDb::Poly2dType  type,
        UcGePoint3dArray& vertices,
        double            elevation     = 0,
        ZSoft::Boolean    closed        = ZSoft::kFalse,
        double            defStartWidth = 0,
        double            defEndWidth   = 0,
        UcGeDoubleArray*  bulges        = nullptr,
		UcArray<ZSoft::Int32>* vertexIdentifiers = nullptr);

    DBCURVE_METHODS

    UcDb::Poly2dType    polyType() const;
    Ucad::ErrorStatus   setPolyType(UcDb::Poly2dType);
    Ucad::ErrorStatus   convertToPolyType(UcDb::Poly2dType newVal);

    Ucad::ErrorStatus   makeClosed();
    Ucad::ErrorStatus   makeOpen();

    double              defaultStartWidth() const;
    Ucad::ErrorStatus   setDefaultStartWidth(double);

    double              defaultEndWidth() const;
    Ucad::ErrorStatus   setDefaultEndWidth(double);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    double              elevation() const;
    Ucad::ErrorStatus   setElevation(double);

    ZSoft::Boolean      isLinetypeGenerationOn() const;
    Ucad::ErrorStatus   setLinetypeGenerationOn();
    Ucad::ErrorStatus   setLinetypeGenerationOff();

    Ucad::ErrorStatus   straighten();
    Ucad::ErrorStatus   splineFit();
    Ucad::ErrorStatus   splineFit(UcDb::Poly2dType splineType,
                                  ZSoft::Int16   splineSegs);
    Ucad::ErrorStatus   curveFit();
    Ucad::ErrorStatus appendVertex(UcDb2dVertex*);
    Ucad::ErrorStatus appendVertex(UcDbObjectId& objId, UcDb2dVertex*);

    Ucad::ErrorStatus insertVertexAt(const UcDb2dVertex* pIndexVert,
        UcDb2dVertex* pNewVertex);
    Ucad::ErrorStatus insertVertexAt(UcDbObjectId& newVertId,
        const UcDbObjectId& indexVertId, UcDb2dVertex* pNewVertex);

    Ucad::ErrorStatus openVertex(UcDb2dVertex*&, UcDbObjectId    vertId,
                                 UcDb::OpenMode,
                                 bool openErasedOne = false) const;
    Ucad::ErrorStatus openSequenceEnd(UcDbSequenceEnd*&, UcDb::OpenMode);

    UcDbObjectIterator*  vertexIterator() const;
    UcGePoint3d       vertexPosition(const UcDb2dVertex& vert) const;
    virtual ZSoft::Boolean    worldDraw   (UcGiWorldDraw* pWd);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};

inline ZSoft::Boolean UcDb2dPolyline::isPeriodic() const
{
    return ZSoft::kFalse;
}
inline ZSoft::Boolean UcDb2dPolyline::isPlanar() const
{
    return ZSoft::kTrue;
}

inline Ucad::ErrorStatus UcDb2dPolyline::getStartParam(double& param) const
{
    param = 0.0;
    return Ucad::eOk;
}

inline Ucad::ErrorStatus UcDb2dPolyline::extend (double param)
{
    return Ucad::eNotApplicable;
}
class UcDb3dPolyline: public UcDbCurve
{
public:
    UcDb3dPolyline();
    ~UcDb3dPolyline();
    UCDB_DECLARE_MEMBERS(UcDb3dPolyline);
    UcDb3dPolyline(UcDb::Poly3dType, UcGePoint3dArray& vertices,
                   ZSoft::Boolean closed = ZSoft::kFalse);

    DBCURVE_METHODS

    Ucad::ErrorStatus   makeClosed();
    Ucad::ErrorStatus   makeOpen();

    UcDb::Poly3dType    polyType() const;
    Ucad::ErrorStatus   setPolyType(UcDb::Poly3dType);
    Ucad::ErrorStatus   convertToPolyType(UcDb::Poly3dType newVal);

    Ucad::ErrorStatus   straighten();
    Ucad::ErrorStatus   splineFit();
    Ucad::ErrorStatus   splineFit(UcDb::Poly3dType splineType,
                                  ZSoft::Int16   splineSegs);
    Ucad::ErrorStatus appendVertex(UcDb3dPolylineVertex*);
    Ucad::ErrorStatus appendVertex(UcDbObjectId& objId, UcDb3dPolylineVertex*);

    Ucad::ErrorStatus insertVertexAt(const UcDb3dPolylineVertex* pIndexVert,
        UcDb3dPolylineVertex* pNewVertex);
    Ucad::ErrorStatus insertVertexAt(UcDbObjectId& newVertId,
        const UcDbObjectId& indexVertId, UcDb3dPolylineVertex* pNewVertex);

    Ucad::ErrorStatus openVertex(UcDb3dPolylineVertex*&, UcDbObjectId vertId,
                                 UcDb::OpenMode,
                                 bool openErasedOne = false);

    Ucad::ErrorStatus openSequenceEnd(UcDbSequenceEnd*&, UcDb::OpenMode);

    UcDbObjectIterator* vertexIterator() const;
    virtual ZSoft::Boolean    worldDraw   (UcGiWorldDraw* pWd);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};
inline ZSoft::Boolean    UcDb3dPolyline::isPeriodic   () const
{
    return ZSoft::kFalse;
}

inline Ucad::ErrorStatus UcDb3dPolyline::getStartParam(double& param) const
{
    param = 0.0;
    return Ucad::eOk;
}

inline Ucad::ErrorStatus UcDb3dPolyline::extend(double newparam)
{

    return Ucad::eNotApplicable;
}
class UcDbArc: public UcDbCurve
{
public:
    UcDbArc();
    UcDbArc(const UcGePoint3d& center, double radius,
            double startAngle, double endAngle);
    UcDbArc(const UcGePoint3d& center, const UcGeVector3d& normal,
            double radius, double startAngle, double endAngle);
    ~UcDbArc();
    UCDB_DECLARE_MEMBERS(UcDbArc);

    DBCURVE_METHODS

    Ucad::ErrorStatus getTransformedCopy(
                      const UcGeMatrix3d& xform,
                      UcDbEntity*& ent) const;

    UcGePoint3d         center() const;
    Ucad::ErrorStatus   setCenter(const UcGePoint3d&);

    double              radius() const;
    Ucad::ErrorStatus   setRadius(double);

    double              startAngle() const;
    Ucad::ErrorStatus   setStartAngle(double);

    double              endAngle() const;
    Ucad::ErrorStatus   setEndAngle(double);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
    virtual void gripStatus(const UcDb::GripStat status);
    virtual Ucad::ErrorStatus   getGripPoints(
                                   UcGePoint3dArray&  gripPoints,
                                   UcDbIntArray&  osnapModes,
                                   UcDbIntArray &  geomIds) const;
    virtual Ucad::ErrorStatus   getGripPoints(UcDbGripDataPtrArray& grips,
        const double curViewUnitSize, const int gripSize,
        const UcGeVector3d& curViewDir, const int bitflags) const;

    virtual bool        castShadows() const;
    virtual bool        receiveShadows() const;
};

inline ZSoft::Boolean UcDbArc::isClosed() const
{
    return ZSoft::kFalse;
}
inline ZSoft::Boolean UcDbArc::isPeriodic() const
{
    return ZSoft::kFalse;
}
inline ZSoft::Boolean UcDbArc::isPlanar() const
{
    return ZSoft::kTrue;
}

class UcDbCircle: public UcDbCurve
{
public:
    UcDbCircle();
    UcDbCircle(const UcGePoint3d& cntr, const UcGeVector3d& nrm, double radius);
    ~UcDbCircle();
    UCDB_DECLARE_MEMBERS(UcDbCircle);

    DBCURVE_METHODS

    Ucad::ErrorStatus getTransformedCopy(
                         const UcGeMatrix3d& xform,
                         UcDbEntity*& ent) const;

    UcGePoint3d         center() const;
    Ucad::ErrorStatus   setCenter(const UcGePoint3d&);

    double              radius() const;
    Ucad::ErrorStatus   setRadius(double);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
    virtual void        gripStatus(const UcDb::GripStat status);
    virtual Ucad::ErrorStatus   getGripPoints(
                                   UcGePoint3dArray&  gripPoints,
                                   UcDbIntArray&  osnapModes,
                                   UcDbIntArray &  geomIds) const;
    virtual Ucad::ErrorStatus   getGripPoints(UcDbGripDataPtrArray& grips,
        const double curViewUnitSize, const int gripSize,
        const UcGeVector3d& curViewDir, const int bitflags) const;

    virtual bool        castShadows() const;
    virtual bool        receiveShadows() const;
};

inline ZSoft::Boolean UcDbCircle::isClosed() const
{
    return ZSoft::kTrue;
}

inline ZSoft::Boolean UcDbCircle::isPeriodic() const
{
    return ZSoft::kTrue;
}

inline ZSoft::Boolean UcDbCircle::isPlanar () const
{
    return ZSoft::kTrue;
}

inline Ucad::ErrorStatus UcDbCircle::getStartParam(double& p) const
{
    p = 0.0;
    return Ucad::eOk;
}

inline Ucad::ErrorStatus UcDbCircle::extend(double)
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbCircle::extend(ZSoft::Boolean, const UcGePoint3d&)
{
    return Ucad::eNotApplicable;
}
class UcDbLine: public UcDbCurve
{
public:
    UcDbLine();
    UcDbLine(const UcGePoint3d& start, const UcGePoint3d& end);
    ~UcDbLine();
    UCDB_DECLARE_MEMBERS(UcDbLine);

    DBCURVE_METHODS

    Ucad::ErrorStatus getTransformedCopy(
                            const UcGeMatrix3d& xform,
                            UcDbEntity*& ent) const;

    Ucad::ErrorStatus getOffsetCurvesGivenPlaneNormal(
        const UcGeVector3d& normal, double offsetDist,
        UcDbVoidPtrArray& offsetCurves) const;

    UcGePoint3d         startPoint() const;
    Ucad::ErrorStatus   setStartPoint(const UcGePoint3d&);

    UcGePoint3d         endPoint() const;
    Ucad::ErrorStatus   setEndPoint(const UcGePoint3d&);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
    virtual void gripStatus(const UcDb::GripStat status);
    virtual Ucad::ErrorStatus   getGripPoints(
                                   UcGePoint3dArray&  gripPoints,
                                   UcDbIntArray&  osnapModes,
                                   UcDbIntArray &  geomIds) const;
    virtual Ucad::ErrorStatus   getGripPoints(UcDbGripDataPtrArray& grips,
        const double curViewUnitSize, const int gripSize,
        const UcGeVector3d& curViewDir, const int bitflags) const;

    virtual bool castShadows() const;
    virtual bool receiveShadows() const;
};

inline ZSoft::Boolean UcDbLine::isClosed() const
{
    return ZSoft::kFalse;
}

inline ZSoft::Boolean UcDbLine::isPeriodic() const
{
    return ZSoft::kFalse;
}

inline ZSoft::Boolean UcDbLine::isPlanar() const
{
    return ZSoft::kTrue;
}

inline Ucad::ErrorStatus UcDbLine::getStartParam(double& v1) const
{
    v1 = 0.0;
    return Ucad::eOk;
}

inline Ucad::ErrorStatus UcDbLine::getSpline(UcDbSpline*&) const
{
    return Ucad::eNotApplicable;
}
class UcDbPoint: public UcDbEntity
{
public:
    UcDbPoint();
    UcDbPoint(const UcGePoint3d&   position);
    ~UcDbPoint();
    UCDB_DECLARE_MEMBERS(UcDbPoint);

    UcGePoint3d         position() const;
    Ucad::ErrorStatus   setPosition(const UcGePoint3d&);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    double              ecsRotation() const;
    Ucad::ErrorStatus   setEcsRotation(double);
    virtual ZSoft::Boolean    isPlanar() const { return ZSoft::kTrue; }
    virtual Ucad::ErrorStatus getPlane(UcGePlane&, UcDb::Planarity&) const;

    virtual ZSoft::UInt32     setAttributes(UcGiDrawableTraits* pTraits);
    virtual ZSoft::Boolean worldDraw(UcGiWorldDraw* mode);
    virtual void viewportDraw(UcGiViewportDraw* pVpDraw);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;

    virtual bool castShadows() const;
    virtual bool receiveShadows() const;
};

class UcDbFace: public UcDbEntity
{
public:
    UcDbFace();
    UcDbFace(const UcGePoint3d&   pt0,
             const UcGePoint3d&   pt1,
             const UcGePoint3d&   pt2,
             const UcGePoint3d&   pt3,
                   ZSoft::Boolean e0vis = ZSoft::kTrue,
                   ZSoft::Boolean e1vis = ZSoft::kTrue,
                   ZSoft::Boolean e2vis = ZSoft::kTrue,
                   ZSoft::Boolean e3vis = ZSoft::kTrue);
    UcDbFace(const UcGePoint3d&   pt0,
             const UcGePoint3d&   pt1,
             const UcGePoint3d&   pt2,
                   ZSoft::Boolean e0vis = ZSoft::kTrue,
                   ZSoft::Boolean e1vis = ZSoft::kTrue,
                   ZSoft::Boolean e2vis = ZSoft::kTrue,
                   ZSoft::Boolean e3vis = ZSoft::kTrue);
    ~UcDbFace();
    UCDB_DECLARE_MEMBERS(UcDbFace);

    Ucad::ErrorStatus getVertexAt(ZSoft::UInt16, UcGePoint3d&) const;
    Ucad::ErrorStatus setVertexAt(ZSoft::UInt16, const UcGePoint3d&);

    Ucad::ErrorStatus isEdgeVisibleAt(ZSoft::UInt16, ZSoft::Boolean&) const;
    Ucad::ErrorStatus makeEdgeVisibleAt(ZSoft::UInt16);
    Ucad::ErrorStatus makeEdgeInvisibleAt(ZSoft::UInt16);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};

class UcDbPolyFaceMesh: public UcDbEntity
{
public:
    UcDbPolyFaceMesh();
    ~UcDbPolyFaceMesh();
    UCDB_DECLARE_MEMBERS(UcDbPolyFaceMesh);

    ZSoft::Int16 numVertices() const;
    ZSoft::Int16 numFaces() const;

    Ucad::ErrorStatus appendVertex(UcDbPolyFaceMeshVertex*);
    Ucad::ErrorStatus appendVertex(UcDbObjectId& objId, UcDbPolyFaceMeshVertex*);

    Ucad::ErrorStatus appendFaceRecord(UcDbFaceRecord*);
    Ucad::ErrorStatus appendFaceRecord(UcDbObjectId&, UcDbFaceRecord*);

    Ucad::ErrorStatus openVertex(UcDbVertex*&, UcDbObjectId subObjId,
                                 UcDb::OpenMode,
                                 bool openErasedOne = false);

    Ucad::ErrorStatus openSequenceEnd(UcDbSequenceEnd*&, UcDb::OpenMode);

    UcDbObjectIterator*  vertexIterator() const;

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};

class UcDbPolygonMesh: public UcDbEntity
{
public:
    UcDbPolygonMesh();
    UcDbPolygonMesh(UcDb::PolyMeshType pType,
                    ZSoft::Int16       mSize,
                    ZSoft::Int16       nSize,
                    const UcGePoint3dArray& vertices,
                    ZSoft::Boolean     mClosed = ZSoft::kTrue,
                    ZSoft::Boolean     nClosed = ZSoft::kTrue);
    ~UcDbPolygonMesh();
    UCDB_DECLARE_MEMBERS(UcDbPolygonMesh);

    UcDb::PolyMeshType  polyMeshType() const;
    Ucad::ErrorStatus   setPolyMeshType(UcDb::PolyMeshType);
    Ucad::ErrorStatus   convertToPolyMeshType(UcDb::PolyMeshType newVal);

    ZSoft::Int16        mSize() const;
    Ucad::ErrorStatus   setMSize(ZSoft::Int16);

    ZSoft::Int16        nSize() const;
    Ucad::ErrorStatus   setNSize(ZSoft::Int16);

    ZSoft::Boolean      isMClosed() const;
    Ucad::ErrorStatus   makeMClosed();
    Ucad::ErrorStatus   makeMOpen();

    ZSoft::Boolean      isNClosed() const;
    Ucad::ErrorStatus   makeNClosed();
    Ucad::ErrorStatus   makeNOpen();

    ZSoft::Int16        mSurfaceDensity() const;
    Ucad::ErrorStatus   setMSurfaceDensity(ZSoft::Int16);

    ZSoft::Int16        nSurfaceDensity() const;
    Ucad::ErrorStatus   setNSurfaceDensity(ZSoft::Int16);

    Ucad::ErrorStatus   straighten();
    Ucad::ErrorStatus   surfaceFit();
    Ucad::ErrorStatus   surfaceFit(UcDb::PolyMeshType surfType,
                                   ZSoft::Int16 surfu, ZSoft::Int16 surfv);
    Ucad::ErrorStatus appendVertex(UcDbPolygonMeshVertex*);
    Ucad::ErrorStatus appendVertex(UcDbObjectId& objId, UcDbPolygonMeshVertex*);

    Ucad::ErrorStatus openVertex(UcDbPolygonMeshVertex*&, UcDbObjectId vertId,
                                 UcDb::OpenMode,
                                 bool openErasedOne = false);

    Ucad::ErrorStatus openSequenceEnd(UcDbSequenceEnd*&, UcDb::OpenMode);

    UcDbObjectIterator*  vertexIterator() const;

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};

class UcDbSolid: public UcDbEntity
{
public:
    UcDbSolid();
    UcDbSolid(const UcGePoint3d&    pt0,
              const UcGePoint3d&    pt1,
              const UcGePoint3d&    pt2,
              const UcGePoint3d&    pt3);
    UcDbSolid(const UcGePoint3d&    pt0,
              const UcGePoint3d&    pt1,
              const UcGePoint3d&    pt2);
    ~UcDbSolid();
    UCDB_DECLARE_MEMBERS(UcDbSolid);

    Ucad::ErrorStatus transformBy(const UcGeMatrix3d& pXform);
    Ucad::ErrorStatus getTransformedCopy(
              const UcGeMatrix3d& xform,
              UcDbEntity*&  pEnt) const;

    Ucad::ErrorStatus getPointAt(ZSoft::UInt16 idx, UcGePoint3d& pntRes) const;
    Ucad::ErrorStatus setPointAt(ZSoft::UInt16 idx, const UcGePoint3d&);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};

class UcDbTrace: public UcDbEntity
{
public:
    UcDbTrace();
    UcDbTrace(const UcGePoint3d&    pt0,
              const UcGePoint3d&    pt1,
              const UcGePoint3d&    pt2,
              const UcGePoint3d&    pt3);
    ~UcDbTrace();
    UCDB_DECLARE_MEMBERS(UcDbTrace);
    Ucad::ErrorStatus getPointAt(ZSoft::UInt16 idx, UcGePoint3d& PntRes) const;
    Ucad::ErrorStatus setPointAt(ZSoft::UInt16 idx, const UcGePoint3d&);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    virtual ZSoft::Boolean    isPlanar() const { return ZSoft::kTrue; }
    virtual Ucad::ErrorStatus getPlane(UcGePlane&, UcDb::Planarity&) const;

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;

    virtual bool        castShadows() const;
    virtual bool        receiveShadows() const;
};

class UcDbShape: public UcDbEntity
{
public:
    UcDbShape();
    UcDbShape(const UcGePoint3d&  position,
                    double        size,
                    double        rotation    = 0,
                    double        widthFactor = 0);
    ~UcDbShape();
    UCDB_DECLARE_MEMBERS(UcDbShape);

    UcGePoint3d         position() const;
    Ucad::ErrorStatus   setPosition(const UcGePoint3d&);

    double              size() const;
    Ucad::ErrorStatus   setSize(double);

    ZTCHAR*              name() const;
    Ucad::ErrorStatus   setName(const ZTCHAR*);

    double              rotation() const;
    Ucad::ErrorStatus   setRotation(double);

    double              widthFactor() const;
    Ucad::ErrorStatus   setWidthFactor(double);

    double              oblique() const;
    Ucad::ErrorStatus   setOblique(double);

    double              thickness() const;
    Ucad::ErrorStatus   setThickness(double);

    UcGeVector3d        normal() const;
    Ucad::ErrorStatus   setNormal(const UcGeVector3d&);

    virtual ZSoft::Boolean    isPlanar() const { return ZSoft::kTrue; }
    virtual Ucad::ErrorStatus getPlane(UcGePlane&, UcDb::Planarity&) const;

    ZSoft::Int16      shapeNumber() const;
    Ucad::ErrorStatus setShapeNumber(ZSoft::Int16);

    UcDbObjectId        styleId() const;
    Ucad::ErrorStatus   setStyleId(UcDbObjectId id);
    UcDbObjectId        shapeIndex() const { return this->styleId(); }
    Ucad::ErrorStatus   setShapeIndex(UcDbObjectId id)
                                 { return this->setStyleId(id); }

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;
};

class UcDbViewport: public UcDbEntity
{
public:
                      UcDbViewport();
                      ~UcDbViewport();
    UCDB_DECLARE_MEMBERS(UcDbViewport);
    Ucad::ErrorStatus setModelView      (const UcDbXrefObjectId &xrefObjId);
    Ucad::ErrorStatus getModelView      (UcDbXrefObjectId &xrefObjId) const;
    Ucad::ErrorStatus removeModelView   (void);

    Ucad::ErrorStatus setSheetView      (UcDbObjectId objId);
    Ucad::ErrorStatus getSheetView      (UcDbObjectId &objId)const;
    Ucad::ErrorStatus removeSheetView   (void);

    Ucad::ErrorStatus setLabelBlock     (UcDbObjectId objId);
    Ucad::ErrorStatus getLabelBlock     (UcDbObjectId &objId)const;
    Ucad::ErrorStatus removeLabelBlock  (void);

    Ucad::ErrorStatus syncModelView     (void);
#ifdef _WINDOWS_
    Ucad::ErrorStatus getThumbnail (BITMAPINFO*& thumbnail) const;
    Ucad::ErrorStatus setThumbnail(const BITMAPINFO * thumbnail);
#endif
    double            height() const;
    Ucad::ErrorStatus setHeight(double);

    double            width() const;
    Ucad::ErrorStatus setWidth(double);

    UcGePoint3d       centerPoint() const;
    Ucad::ErrorStatus setCenterPoint(const UcGePoint3d&);

    ZSoft::Int16      number() const;

    bool              isOn() const;
    Ucad::ErrorStatus setOn();
    Ucad::ErrorStatus setOff();

    UcGePoint3d       viewTarget() const;
    Ucad::ErrorStatus setViewTarget(const UcGePoint3d&);

    UcGeVector3d      viewDirection() const;
    Ucad::ErrorStatus setViewDirection(const UcGeVector3d&);
    double            viewHeight() const;
    Ucad::ErrorStatus setViewHeight(double ht);

    UcGePoint2d       viewCenter() const;
    Ucad::ErrorStatus setViewCenter(const UcGePoint2d& pt);

    double            twistAngle() const;
    Ucad::ErrorStatus setTwistAngle(double);

    double            lensLength() const;
    Ucad::ErrorStatus setLensLength(double);

    bool              isFrontClipOn() const;
    Ucad::ErrorStatus setFrontClipOn();
    Ucad::ErrorStatus setFrontClipOff();

    bool              isBackClipOn() const;
    Ucad::ErrorStatus setBackClipOn();
    Ucad::ErrorStatus setBackClipOff();

    bool              isFrontClipAtEyeOn() const;
    Ucad::ErrorStatus setFrontClipAtEyeOn();
    Ucad::ErrorStatus setFrontClipAtEyeOff();
    double            frontClipDistance() const;
    Ucad::ErrorStatus setFrontClipDistance(double newVal);
    double            backClipDistance() const;
    Ucad::ErrorStatus setBackClipDistance(double newVal);

    bool              isPerspectiveOn() const;
    Ucad::ErrorStatus setPerspectiveOn();
    Ucad::ErrorStatus setPerspectiveOff();

    bool              isUcsFollowModeOn() const;
    Ucad::ErrorStatus setUcsFollowModeOn();
    Ucad::ErrorStatus setUcsFollowModeOff();

    bool              isUcsIconVisible() const;
    Ucad::ErrorStatus setUcsIconVisible();
    Ucad::ErrorStatus setUcsIconInvisible();

    bool              isUcsIconAtOrigin() const;
    Ucad::ErrorStatus setUcsIconAtOrigin();
    Ucad::ErrorStatus setUcsIconAtCorner();

	bool              isFastZoomOn() const { return true; }
	Ucad::ErrorStatus setFastZoomOn() { return Ucad::eOk; }
	Ucad::ErrorStatus setFastZoomOff() { return Ucad::eOk; }

    ZSoft::UInt16     circleSides() const;
    Ucad::ErrorStatus setCircleSides(ZSoft::UInt16);

    bool              isSnapOn() const;
    Ucad::ErrorStatus setSnapOn();
    Ucad::ErrorStatus setSnapOff();

    bool              isSnapIsometric() const;
    Ucad::ErrorStatus setSnapIsometric();
    Ucad::ErrorStatus setSnapStandard();

    double            snapAngle() const;
    Ucad::ErrorStatus setSnapAngle(double);

    UcGePoint2d       snapBasePoint() const;
    Ucad::ErrorStatus setSnapBasePoint(const UcGePoint2d&);

    UcGeVector2d      snapIncrement() const;
    Ucad::ErrorStatus setSnapIncrement(const UcGeVector2d&);

    ZSoft::UInt16     snapIsoPair() const;
    Ucad::ErrorStatus setSnapIsoPair(ZSoft::UInt16);

    bool              isGridOn() const;
    Ucad::ErrorStatus setGridOn();
    Ucad::ErrorStatus setGridOff();

    bool              isGridBoundToLimits() const;
    Ucad::ErrorStatus setGridBoundToLimits(bool bNewVal);

    bool              isGridAdaptive() const;
    Ucad::ErrorStatus setGridAdaptive(bool bNewVal);

    bool              isGridSubdivisionRestricted() const;
    Ucad::ErrorStatus setGridSubdivisionRestricted(bool bNewVal);

    bool              isGridFollow() const;
    Ucad::ErrorStatus setGridFollow(bool bNewVal);

    ZSoft::UInt16     gridMajor() const;
    Ucad::ErrorStatus setGridMajor(ZSoft::UInt16);

    UcGeVector2d      gridIncrement() const;
    Ucad::ErrorStatus setGridIncrement(const UcGeVector2d&);

    bool              hiddenLinesRemoved() const;
    Ucad::ErrorStatus showHiddenLines();
    Ucad::ErrorStatus removeHiddenLines();

    Ucad::ErrorStatus freezeLayersInViewport(const UcDbObjectIdArray&);
    Ucad::ErrorStatus thawLayersInViewport(const UcDbObjectIdArray&);
    Ucad::ErrorStatus thawAllLayersInViewport();
    bool              isLayerFrozenInViewport(const UcDbObjectId& layerId) const;
    Ucad::ErrorStatus getFrozenLayerList(UcDbObjectIdArray& ids) const;

    Ucad::ErrorStatus updateDisplay() const;

    UcDbObjectId       background() const;
    Ucad::ErrorStatus  setBackground(UcDbObjectId backgroundId);
    UcDbObjectId       previousBackground(UcGiDrawable::DrawableType type
                                          = UcGiDrawable::kGeometry) const;
    Ucad::ErrorStatus  setPreviousBackground(UcDbObjectId backgroundId,
                                             UcGiDrawable::DrawableType type
                                             = UcGiDrawable::kGeometry);
    UcDbObjectId      visualStyle() const;
    Ucad::ErrorStatus setVisualStyle(const UcDbObjectId oidVisualStyle);
    bool                isDefaultLightingOn() const;
    Ucad::ErrorStatus   setDefaultLightingOn(bool on);
    UcGiViewportTraits::DefaultLightingType defaultLightingType() const;
    Ucad::ErrorStatus   setDefaultLightingType(UcGiViewportTraits::DefaultLightingType typ);
    double              brightness() const;
    Ucad::ErrorStatus   setBrightness(double);

    double              contrast() const;
    Ucad::ErrorStatus   setContrast(double);

    UcCmColor           ambientLightColor() const;
    Ucad::ErrorStatus   setAmbientLightColor(const UcCmColor& clr);
    UcDbObjectId        sunId() const;
    Ucad::ErrorStatus   setSun(UcDbObjectId& retId, UcDbObject* pSun);
    virtual ZSoft::UInt32     setAttributes(UcGiDrawableTraits*);
    virtual ZSoft::Boolean    worldDraw   (UcGiWorldDraw* pWd);

    bool              isLocked() const;
    Ucad::ErrorStatus setLocked();
    Ucad::ErrorStatus setUnlocked();

    Ucad::ErrorStatus setAnnotationScale(const UcDbAnnotationScale *pScaleObj);
    UcDbAnnotationScale* annotationScale() const;

    bool              isTransparent() const;
    Ucad::ErrorStatus setTransparent();
    Ucad::ErrorStatus setOpaque();

    enum StandardScaleType {
        kScaleToFit,                  
        kCustomScale,                 
        k1_1,                         
        k1_2,                         
        k1_4, 
		k1_5,
        k1_8,                         
        k1_10,                        
        k1_16,                        
        k1_20,                        
        k1_30,                        
        k1_40,                        
        k1_50,                        
        k1_100,                       
        k2_1,                         
        k4_1,                         
        k8_1,                         
        k10_1,                        
        k100_1,                       
        k1_128in_1ft,                 
        k1_64in_1ft,                  
        k1_32in_1ft,                  
        k1_16in_1ft,                  
        k3_32in_1ft,                  
        k1_8in_1ft,                   
        k3_16in_1ft,                  
        k1_4in_1ft,                   
        k3_8in_1ft,                   
        k1_2in_1ft,                   
        k3_4in_1ft,                   
        k1in_1ft,                     
        k1and1_2in_1ft,               
        k3in_1ft,                     
        k6in_1ft,                     
        k1ft_1ft                      
    };

    double            customScale() const;
    Ucad::ErrorStatus setCustomScale(double);

    StandardScaleType standardScale() const;
    Ucad::ErrorStatus setStandardScale(const StandardScaleType);

    Ucad::ErrorStatus plotStyleSheet(ZTCHAR *&) const;
    Ucad::ErrorStatus plotStyleSheet(const ZTCHAR *&) const;
    Ucad::ErrorStatus effectivePlotStyleSheet(const ZTCHAR *&);
    Ucad::ErrorStatus setPlotStyleSheet(const ZTCHAR *);

    bool              isNonRectClipOn() const;
    Ucad::ErrorStatus setNonRectClipOn();
    Ucad::ErrorStatus setNonRectClipOff();

    UcDbObjectId      nonRectClipEntityId() const;
    Ucad::ErrorStatus setNonRectClipEntityId(UcDbObjectId);

    virtual void      erased(const UcDbObject* , ZSoft::Boolean);
    virtual void      modified(const UcDbObject *);
    virtual void      copied(const UcDbObject* pDbObj,const UcDbObject* pNewObj);
    virtual void      subObjModified(const UcDbObject* pDbObj,
                            const UcDbObject* pSubObj);

    Ucad::ErrorStatus getUcs (UcGePoint3d& origin,
                                UcGeVector3d& xAxis,
                                UcGeVector3d& yAxis ) const;
    bool              isUcsOrthographic(UcDb::OrthographicView& view) const;
    UcDbObjectId      ucsName           () const;
    double            elevation         () const;

    Ucad::ErrorStatus setUcs(const UcGePoint3d& origin,
                                const UcGeVector3d& xAxis,
                                const UcGeVector3d& yAxis);
    Ucad::ErrorStatus setUcs(UcDb::OrthographicView view);
    Ucad::ErrorStatus setUcs(const UcDbObjectId& ucsId);
    Ucad::ErrorStatus setUcsToWorld();
    Ucad::ErrorStatus setElevation(double elev );

    bool           isViewOrthographic(UcDb::OrthographicView& view ) const;
    Ucad::ErrorStatus setViewDirection(UcDb::OrthographicView view );

    bool           isUcsSavedWithViewport () const;
    void           setUcsPerViewport ( bool ucsvp );

    void setRenderMode(UcDbAbstractViewTableRecord::RenderMode mode);
    UcDbAbstractViewTableRecord::RenderMode renderMode() const;

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;

    enum ShadePlotType {
        kAsDisplayed    = 0,
        kWireframe      = 1,
        kHidden         = 2,
        kRendered       = 3,
        kVisualStyle    = 4,
        kRenderPreset   = 5
    };

    ShadePlotType     shadePlot() const;
    Ucad::ErrorStatus setShadePlot(const ShadePlotType);

    UcDbObjectId      shadePlotId() const;
    Ucad::ErrorStatus setShadePlot(const ShadePlotType type,
                                   const UcDbObjectId shadePlotId);

    bool              plotWireframe() const;
    bool              plotAsRaster()  const;

    Ucad::ErrorStatus toneOperatorParameters(UcGiToneOperatorParameters& params) const;
    Ucad::ErrorStatus setToneOperatorParameters(const UcGiToneOperatorParameters& params);
};

#pragma pack(pop)

#endif
